#include "Generate_C_std.h"
/*
 * $$x = $y
 */

class Pattern_assign_var_var : public Pattern
{
	bool match(Statement* that)
	{
		index = new Wildcard<VARIABLE_NAME>;
		rhs = new Wildcard<Rvalue>;
		agn = new Assign_var_var(index, false, rhs);
		return(that->match(agn));	
	}

	void generate_code(Generate_C* gen)
	{
		if(!agn->is_ref)
			INST (buf, "assign_var_var",
				index->value, rhs->value);
		else
			INST (buf, "assign_var_var_ref",
				index->value, rhs->value);
	}

	Assign_var_var* agn;
	Wildcard<VARIABLE_NAME>* index;
	Wildcard<Rvalue>* rhs;
};

CREATE(Pattern_assign_var_var);
